package com.cictec.middleware.tde.rm.disp.receiver.handler;

import org.apache.mina.core.session.IoSession;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.cictec.middleware.tde.rm.disp.annotation.HandleMessages;
import com.cictec.middleware.tde.rm.disp.receiver.AbstractReceiverHandler;
import com.cictec.middleware.tde.rm.protocol.TerminalMessage;

@Component
@HandleMessages({ 0X25, 0X26, 0X27, 0X28 })
public class TerminalInfoHandler extends AbstractReceiverHandler {

	private static Logger logger = LoggerFactory.getLogger(TerminalInfoHandler.class);

	@Override
	public void handleMessage(TerminalMessage message, IoSession session) {

		sendMessageToTerminal(createResponse(message), session);

		String id = Integer.toHexString(message.getHeader().getMessageId());
		logger.debug("【0X{} 状态上报】终端 {}  Session {} ", id, message.getTerminalId(), message.getSessionId());
	}

}
